package hongcaosp.app.android.user.settings.invite;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.view.Gravity;
import android.view.View;
import android.view.WindowManager;

import hongcaosp.app.android.R;

/**
 * 邀请码验证成功
 */
public class DialogSuccess extends Dialog {

    private View.OnClickListener listener;
    public DialogSuccess(@NonNull Context context, View.OnClickListener listener) {
        super(context);
        this.listener = listener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        getWindow().setGravity(Gravity.CENTER);
        getWindow().setLayout(WindowManager.LayoutParams.WRAP_CONTENT, WindowManager.LayoutParams.WRAP_CONTENT);

        setContentView(R.layout.dialog_invite_success);
        setCanceledOnTouchOutside(false);

        findViewById(R.id.btn_confirm).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                dismiss();
                listener.onClick(v);
            }
        });
    }
}
